<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>GraceCreate模块创建器</title>
</head>
<style type="text/css">
    * {
        margin:0;
        padding:0;
    }
    .left {
        width:250px;
        height:600px;
        border:1px solid #ccc;
        float:left;
        margin:20px 0 0 300px;
    }
    .left ul {
        padding:20px 0 20px 50px;
        list-style:none;
    }
    .left ul li {
        height:60px;
    }
    .left ul li a {
        text-decoration:none;
        color:#06f;
    }
    .right {
        width:500px;
        height:600px;
        float:left;
        margin:20px 0 0 30px;
        border:1px solid #ccc;
    }
    .right h3 {
        text-align:center;
        color:#06f;
        height:40px;
        line-height:40px;
        border-bottom:1px solid #eee;
        font-weight:normal;
    }
    .right form {
        text-align:center;
        margin:50px;
        font-size:13px;
    }
    .right form label {
        display:inline-block;
        width:110px;
    }
    .right form select {
        width:200px;
        height:30px;
    }
    .text {
        width:200px;
        height:25px;
        margin-bottom:10px;
    }
    .right .btn {
        margin-top:25px;
        width:200px;
        height:30px;
        cursor:pointer;
    }
    ul li.current {
        color:#f60;
    }
</style>
<body>
    <div class="left">
        <ul>
            <li <?php if(!isset($_GET['step'])) echo 'class="current"'?>>第一步：选择应用</li>
            <li <?php if($_GET['step'] == 2) echo 'class="current"'?>>第二步：选择创建类型</li>
            <li <?php if($_GET['step'] == 3) echo 'class="current"'?>>第三步：填写具体细节</li>
        </ul>
    </div>

    <div class="right">
        <?php if(!isset($_GET['step'])):?>
        <div class="step1">
            <h3>选择应用</h3>
            <form method="post" action="?create=do&step=2">
                <select name="app">
                    <?php foreach($apps as $k=>$v):?>
                        <option value="<?php echo $v;?>"><?php echo $v;?></option>
                    <?php endforeach;?>
                </select><br/>
                <input type="submit" name="send" value="确　定" class="btn"/>
            </form>
        </div>
        <?php endif;?>
        <?php if(isset($_GET['step']) && $_GET['step'] == 2):?>
        <div class="step1">
            <h3>选择创建类型</h3>
            <h3>当前选择的应用：<?php echo $_SESSION['create']['currentApp'];?></h3>
            <form method="post" action="?create=do&step=3">
                <select name="type">
                    <option value="1">控制器</option>
                    <option value="2">模　型</option>
                </select><br/>
                <input type="submit" name="send" value="确　定" class="btn"/>
            </form>
        </div>
        <?php endif;?>
        <?php if(isset($_GET['step']) && $_GET['step'] == 3):?>
            <div class="step1">
                <h3>填写细节</h3>
                <h3>当前选择的应用：<?php echo $_SESSION['create']['currentApp'];?></h3>
                <h3>当前选择的类型：<?php echo $types[$_SESSION['create']['currentType']];?></h3>
                <form method="post" action="?create=do&step=finish">
                    <?php if($_SESSION['create']['currentType'] == 1):?>
                        <label>填写控制器名字：</label>
                        <input type="text" name="controller" class="text"/><br/>
                        <span>(不带Controller)</span><br/><br/>
                        <label>选择模型：</label><select name="model">
                            <?php foreach($models as $k=>$v):?>
                                <?php $short = str_replace(Config::getItem('db.tablePrefix'), '', $v);?>
                                <option value="<?php echo $short;?>"><?php echo $v;?></option>
                            <?php endforeach;?>
                        </select><br/>
                        <input class="btn" type="submit" value="确定"/>
                    <?php endif;?>

                    <?php if($_SESSION['create']['currentType'] == 2):?>
                        <label>选择表：</label>
                        <select name="table">
                            <?php foreach($tables as $k=>$v):?>
                                <?php $short = str_replace(Config::getItem('db.tablePrefix'), '', $v);?>
                                <option value="<?php echo $short;?>"><?php echo $v;?></option>
                            <?php endforeach;?>
                        </select><br/>
                        <input class="btn" type="submit" value="确定"/>
                    <?php endif;?>
                </form>
            </div>
        <?php endif;?>
    </div>
</body>
</html>